/****************************************************************************
 *
 *  ALi (Shanghai) Corporation, All Rights Reserved. 2005 Copyright (C)
 *
 *  File: win_diagnosis.h
 *
 *  Description: Head file of win_diagnosis.c , include some header files and defined some constants for UI.
 *
 *  History:
 *  Date            Author  Version  Comment
 *  ====            ======  =======  =======
 *  1.  2006.12.29    Eric Li     0.1.000     Initial
 *  2.  2007.01.10    Eric Li     0.1.001     Add a macro for conditional compile.
 ****************************************************************************/
#ifndef _WIN_DIAGNOSIS_H_
#define _WIN_DIAGNOSIS_H_

#include <sys_config.h>
#include <types.h>
#include <basic_types.h>
#include <api/libosd/osd_lib.h>
#include <bus/i2c/i2c.h>

#include "win_com.h"
#include "osdobjs_def.h"

#include "osd_config.h"
#include "mobile_input.h"

#define WIN_DIAG_WIDTH      900//608
#define WIN_DIAG_HEIGHT     580//430
#define WIN_DIAG_LEFT       GET_MID_L(WIN_DIAG_WIDTH)
#define WIN_DIAG_TOP        GET_MID_T(WIN_DIAG_HEIGHT)

#define TXT_DIAG_LEFT       (WIN_DIAG_LEFT + 20)
#define TXT_DIAG_TOP        (WIN_DIAG_TOP + 30)
#define TXT_DIAG_TITLE_WIDTH (WIN_DIAG_WIDTH - 40)     //588

#define TXT_DIAG_LBL_WIDTH 	160
#define TXT_DIAG_LBL_GAP 	200
#define EDF_NUM_WIDTH 		40
#define EDF_DATA_WIDTH 		300

#define TXT_DIAG_HEIGHT 	40  //28
#define TXT_DIAG_VGAP 		50

#define BTN_DIAG_LEFT 		(WIN_DIAG_LEFT + WIN_DIAG_WIDTH/2 - TXT_DIAG_LBL_WIDTH) //TXT_DIAG_LEFT //180

#define LBL_DATA_LEN_LEFT 	TXT_DIAG_LEFT+TXT_DIAG_LBL_GAP+EDF_DATA_WIDTH+10

#define WSTL_DIAG_TEXT 		    WSTL_DIAG_BUTTON_01_8BIT //WSTL_BUTTON_01
#define WSTL_DIAG_BUTTON_01 	WSTL_DIAG_BUTTON_01_8BIT //WSTL_BUTTON_01
#define WSTL_DIAG_BUTTON_02 	WSTL_BUTTON_05_8BIT//WSTL_BUTTON_05
#define WSTL_DIAG_BUTTON_03 	WSTL_BUTTON_05_8BIT //WSTL_BUTTON_04
#define WSTL_DIAG_BG_02 		WSTL_DIAG_WIN_8BIT //WSTL_GAMEWIN_01
#define DIAG_WSTL_NO_SHOW       WSTL_NOSHOW_IDX

#define STR_I2C_TITLE_ID		0
#define STR_LBL_I2CID_ID		1
#define STR_LBL_ADDR_ID		2
#define STR_LBL_WDATA_ID		3
#define STR_LBL_WLEN_ID		4
#define STR_LBL_RDATA_ID		5
#define STR_LBL_RLEN_ID			6
#define STR_BTN_W_R_ID			7
#define STR_BTN_EXIT_ID			8
#define STR_DIAG_TITLE_ID 		9
#define STR_BTN_REGISTER_ID 	10
#define STR_BTN_I2C_ID 			11

#define DIAG_STR_CNT 			12
#define DIAG_STR_LENGTH 		16

extern CONTAINER win_diag;
extern CONTAINER diag_i2c;
extern CONTAINER diag_register;
extern mobile_input_type_t mobile_input_type;
extern UINT32 mobile_key_caps_flag;

VACTION diag_btn_keymap(POBJECT_HEAD obj, UINT32 key);
VACTION diag_con_keymap(POBJECT_HEAD obj, UINT32 key);
VACTION diag_edf_keymap(POBJECT_HEAD pObj, UINT32 key);
PRESULT diag_hex_edf_callback(POBJECT_HEAD pObj, VEVENT event, UINT32 param1, UINT32 param2);
PRESULT diag_exit_callback(POBJECT_HEAD obj, VEVENT event, UINT32 param1, UINT32 param2);

UINT32 ComHex2UniStr(UINT16 *pBuffer, UINT32 num, UINT32 len);
UINT32 ComUniStr2Hex(const UINT16* string);
void ComUniStr2HexArr(UINT8 *pData, const UINT16* string, UINT8 length);
UINT32 ComHexArr2UniStr(UINT16 *pString, const UINT8 *pData, UINT16 len);

#endif

